package hr.sting.droidorm.types;

import java.util.HashMap;
import java.util.Map;

/**
 * @author mstipanov
 * @since 13.09.2010. 18:40:44
 */
public class JavaToSQLiteTypeMapping implements JavaToSQLTypeMapping {
    private static final Map<Class, String> MAP = new HashMap<Class, String>();

    static {
        MAP.put(String.class, "TEXT");
        MAP.put(java.math.BigDecimal.class, "NUMERIC");
        MAP.put(boolean.class, "BIT");
        MAP.put(byte.class, "TINYINT");
        MAP.put(short.class, "SMALLINT");
        MAP.put(int.class, "INTEGER");
        MAP.put(long.class, "BIGINT");
        MAP.put(float.class, "REAL");
        MAP.put(double.class, "DOUBLE");
        MAP.put(byte[].class, "BINARY");
        MAP.put(java.sql.Date.class, "DATE");
        MAP.put(java.sql.Time.class, "TIME");
        MAP.put(java.sql.Timestamp.class, "TIMESTAMP");
        MAP.put(java.util.Date.class, "TIMESTAMP");
    }

    @Override
    public String getSQLType(Class<?> javaType) {
        return MAP.get(javaType);
    }
}
